/**
 * @Description: 按钮组件
 * @author 范东洋
 * @date 2020/3/31
 */
import React from 'react';
import {TouchableOpacity, Text, StyleSheet} from 'react-native'
import PropTypes from 'prop-types';
import {color} from '../utils'

export const Button = ({onPress, children, btStyle, title, titleStyle, disabled = false}) => (
    <TouchableOpacity disabled={disabled} activeOpacity={.8} style={[sty.container, {...btStyle}]} onPress={onPress}>
        {children ? children : <Text style={[sty.titleSty, {...titleStyle}]}>{title}</Text>}
    </TouchableOpacity>
)
Button.prototype = {
    onPress: PropTypes.func.isRequired,
    title: PropTypes.string
}
const sty = StyleSheet.create({
    container: {
        width: '75%',
        height: 48,
        borderRadius: 25,
        justifyContent: 'center',
        alignItems: 'center',
        backgroundColor: color.white,
        borderColor: color.white,
        borderWidth: 1,
        alignSelf: 'center',
    },
    titleSty: {
        color: color.theme,
        fontSize: 18,
        fontWeight: '500'
    }
})
